package servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import Dao.Daoorder;
import Dao.impl.Daoimplorder;
import entity.Order;

@WebServlet(name = "g_wodedingdan",urlPatterns="/gwodedingdan.do")
public class g_wodedingdan extends HttpServlet {

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
				request.setCharacterEncoding("utf-8");
				HttpSession session1 = request.getSession();
				int sq= (Integer) session1.getAttribute("che");
				
				String zid = request.getParameter("zhuangtai");
				String shijian1 = request.getParameter("shijian1");
				String shijian2 = request.getParameter("shijian2");
				
				request.setAttribute("zhuangtai", zid);
				request.setAttribute("shijian1", shijian1);
				request.setAttribute("shijian2", shijian2);
				
				
				
				Daoorder dao = new Daoimplorder();
				List<Order> list = dao.all(shijian1, shijian2, zid, sq);
				request.setAttribute("list", list);
				request.getRequestDispatcher("GWoDeDingDan.jsp").forward(request, response);
				
		
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
				doGet(request, response);
	}

}
